from merengue.base.admin import BaseCategoryAdmin, BaseContentAdmin
from merengue.section.admin import DocumentAdmin

from plugins.sportteam.models import Technique, Player, Chronicle, TournamentType, Tournament, SubscriptionTournament
from plugins.subscription.admin import BaseSubscriptionAdmin


class TechniqueAdmin(BaseContentAdmin):
    pass


class PlayerAdmin(BaseContentAdmin):
    pass


class ChronicleAdmin(DocumentAdmin):
    pass


class TournamentTypeAdmin(BaseCategoryAdmin):
    pass


class TournamentAdmin(BaseContentAdmin):
    list_filter = BaseContentAdmin.list_filter + ('tournament_type', )


class SubscriptionTournamentAdmin(BaseSubscriptionAdmin):
    list_display = ('first_name', 'last_name', 'email', 'sex', 'height', 'want_a_disc', 'has_payed', 'options')
    list_filter = ('subscribable', 'sex', 'has_payed', 'options')
    report_fields = report_display_fields = ('first_name', 'last_name', 'email', 'phone', 'sex',
                     'is_vegetarian', 'tshirt_size', 'want_a_disc',
                     'departure', 'departure_place', 'day_of_arrival', 'day_of_arrival_place',
                     'number_of_tournamets_played', 'year_played', 'score', 'position', 'has_payed',
                     'options', 'suggestions')
    report_filter_fields = ('subscribable', 'sex', 'has_payed', 'want_a_disc', 'tshirt_size', )


def register(site):
    """ Merengue admin registration callback """
    site.register(Technique, TechniqueAdmin)
    site.register(Player, PlayerAdmin)
    site.register(Chronicle, ChronicleAdmin)
    site.register(TournamentType, TournamentTypeAdmin)
    site.register(Tournament, TournamentAdmin)
    site.register(SubscriptionTournament, SubscriptionTournamentAdmin)


def unregister(site):
    """ Merengue admin unregistration callback """
    site.unregister(Technique)
    site.unregister(Player)
    site.unregister(Chronicle)
    site.unregister(TournamentType)
    site.unregister(Tournament)
    site.unregister(SubscriptionTournament)
